package com.cryptoneedle.center.doris.task;

import com.cryptoneedle.center.doris.service.DorisService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * <p>description: Doris 同步任务 </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-25
 */
@Component
@Slf4j
public class DorisSyncTask {

    @Resource
    private DorisService dorisService;

    @Scheduled(cron = "0 0/10 * * * ?")
    public void dailyTask() {
        log.info("Doris Sync Task => Start");
        boolean success = dorisService.trySync();
        if (success) {
            log.info("Doris Sync Task => Finish");
        } else {
            log.info("Doris Sync Task => Jump");
        }
    }
}